package demo1;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Test {
    public static void main(String[] args) {
        Map<String, Integer> map = new TreeMap<>();
        map.put("hello",10);
        map.put("hello",30);
        map.put("hello",40);
        map.put("world",20);
        System.out.println(map);
        System.out.println(map.get("hello"));
        System.out.println(map.get("hhhh"));
        map.remove("hello");
        System.out.println(map.getOrDefault("hello", 100));
        Set<String> set = map.keySet();
        System.out.println(set);
        System.out.println(map.containsKey("world"));
        System.out.println(map.containsValue(10));
        Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
        System.out.println(entrySet);
    }
}
